package com.freshmarket.freshmarket.configuration;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
@Configuration
public class AlipayConfig {
    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000116665420";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCGLGEdqZonLpC6FmUMdizMKFXXJs5PojIwzHto71S68uZ1HhqsRnnQk/TbAbSzDhYs/Ebz3PVkZOxITxarg127GODLhtPkoNGUic8rR/VK/jnE21FxRWgBOTjNqGoXQgaivUodZcLkZIqvnG7eKpdBo9UL9Gk3XQ+zzt5ewnRCTuXWpaPhSNXyUXayVskkd8fCS/rGSiKJDnwKEb5CmX40YEdKJ/6C/Kr7eP9bBjwLgER4s2xz44rCy85G0G025hLo5KeXRMpNnaUp+ulja4l1DV4mpEeMq0sQbD+zKz+ByCqjIkH1UEkgHyQuH31moc8BQH0y30ZCBCHkitUhNQr5AgMBAAECggEAMdEWedn392ZNrBoWiKrz9RVg0dKBtYWGVyIFDDAYaJU5RfDYfHBqWCwnNI2MlxK63xcIDRFUN2NVa3+Z7jKHQal6BXdZA0FGr3z/Y5WDGMYNku7PbVwUwqeJVKqcQWhtaE0Z0JJw6zX9XDib3Xc409FNj/O+gSTXaK59V/ehDOEOiaTJ0MYlSj/VwWejKvS53Dsyz9883DaSj88hFVwQ/N5Qae0pCkmvNE01oSZE9Y8K9oGPeN9XIGgHgjNg0PHqcLTDWlZaGR/0I4EfowB1Gq0F9I+VhoBKPRlHzZsVP9q1ij6TSJbGyGLkw2cqbQhZ0jEKpM/5z8ISiR9NR3wVUQKBgQDE+/bwyZFTdnaH3KyrM+sZNbfYnfERmjvicneADWljOAqY+9T3CiwLcJ3UU2z9cLANgtU8u+spyf694tfQrc8wwn05MheEqI/RokooDhV9uH21n6L6E6AdsUpSsdqNOIPB7wMNLi4/RCvaV4zIRK2MaokG6xCYdelxsG1wdfymFQKBgQCuXwd/+iokei5cqwqDFE98Imnp1vAy3i9U62yS5OnYNic6o5FFG6LU/NftrgQXcCGAqaElRFw9wFMGX1UsHla4CidhcXUlFAPkWQn4HP8vlvV4jrCmbKRG7swxlznLXkGl/2VvzsfnYZO6N5MZPtX2SXbzbPht0DAACFRT/DnOVQKBgAO1gtbR1MyvhFfWjeHDXn/hBQ8tGibssof3A80Dc6KMoZZz13S3WlD00+P1li3He2klt4InP6xPw14r8UhanXYbk2QKT2sOCXc3CRJsAXeWi7dpxBXVXMRyXCXmd2kFUWXLbFFJN1G1pOW9lEcJFAN61g2tS2izf6vGWKkvb4xpAoGAV2puoRrx+52BFpXszC/ndSzvefp2Kpo2klT/9lhqXyku23fawRGMvUgQnCgsBvAA67aegcdWkuKS/NPYKCkBgnwcp/4wIyl4lgaJN+iZiesdHpYyOwymAqV+mrHcmHalZKm32aiJkRba73Ui+noE29aSmpCbrrm7BpkmZYBCHo0CgYEAnXaqNJJ7ajLDAh8pH7L42lKR7Vljo/DiLVlZA3OjaWo/OR9EwqqBpoEB5aMcg8yAHw61884n7F9uMp7SLYFGg/j/q+L4cK9gIDrkue/k5rEia7jpZGxx1WQq2jp6JfpvdD493ZyzQD2qQfejydUav8PPxUDseOo9gDdrW5Q4q8s=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtHQtK8NOU/L9Esz3zsuqUwIw7dF8XSlyCX5hUiElxF6PXAL45S0lWvSRvjqopimVvmlX7gNZMgZSHowJN0RP+7G6HWyCs5VJZDoi+ticlUsmveBixb3QTEUQEOkankuNHQWDSakbETEzSUcCncgdgyd4XpGNp4p/VmyUuyWx0Psdt3eBp56jrCA0li29AUXtoi3hWAzMNhXcSm7dfFUTr12hmBvMX5V/ziPb3EcPRycHRxVAbydcXCe5cb37zxEz/LDaZA+wmb7C8Y+mRuf/F4mw8NSj+NkZxJdG6watSjnTM0jbNKCTs6MxTq9AqrA0LyQy+7D2u1eXtrYluhMcuQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://l330562l48.qicp.vip/payNotify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://l330562l48.qicp.vip/index";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
